import { useState } from "react";
// 父子传值
function MyButton({ count, countAdd }) {
  return (
    <div className="">
      <div className="">{count}</div>
      <button onClick={() => countAdd(count + 1)}>Click</button>
    </div>
  );
}

function App() {
  const [count, setCount] = useState(0);
  return (
    <div className="App">
      <MyButton count={count} countAdd={setCount} />
    </div>
  );
}

export default App;
